//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.carhailing.system.controller;

import com.carhailing.common.domain.DriverUser;
import com.carhailing.common.response.IdentificationResponse;
import com.carhailing.common.result.Result;
import com.carhailing.system.service.RegimentalService;
import com.carhailing.system.util.OssUtil;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class RegimentalController {
    @Autowired
    private RegimentalService regimentalService;
    @Autowired
    private OssUtil ossUtil;

    public RegimentalController() {
    }

    @PostMapping({"/faceDetails"})
    public Result<IdentificationResponse> faceDetails(@RequestParam("file") MultipartFile file) throws IOException {
        try {
            String url = this.ossUtil.fileUpload(file);
            IdentificationResponse ident = this.ossUtil.backMessage(url);
            return Result.success(ident);
        } catch (Exception var4) {
            throw new RuntimeException(var4);
        }
    }

    @PostMapping({"/upload"})
    public Result upload(@RequestParam("file") MultipartFile file) throws Exception {
        String url = this.ossUtil.fileUpload(file);
        return Result.success(url);
    }

    @PostMapping({"/authentication"})
    public Result authentication(@RequestBody DriverUser driverUser) throws Exception {
        return Result.success(this.regimentalService.authentication(driverUser));
    }
}
